package br.ufmg.ubicomp.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class DateUtil {

	public static String formatDate(Calendar date, String format){
		SimpleDateFormat sdf = new SimpleDateFormat(format);
		return sdf.format(date.getTime());
	}

	public static Calendar parseXmlDateTime(String text) throws ParseException {
		String format = "yyyy-MM-dd hh:mm:ss.SSSSSS";
		SimpleDateFormat sdf = new SimpleDateFormat(format);
		Calendar c = Calendar.getInstance();
		c.setTime(sdf.parse(text));
		return c;
	}
}
